package com.mt.grand.singleton.reflect;

public class ReflectSingleton {
    private static boolean isInitialised = false;

    private static ReflectSingleton reflectSingleton = new ReflectSingleton();

    private ReflectSingleton(){
        synchronized (ReflectSingleton.class){
            if(!isInitialised){
                System.out.println("第一次初始化");
                isInitialised = !isInitialised;
            }else{
                throw new RuntimeException("构造函数遭侵入");
            }
        }
    }

    public static ReflectSingleton getInstance(){
        return reflectSingleton;
    }
}